package com.example.autoboot.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.example.autoboot.activity.MainActivity2;

public class BootCompleteReceiver extends BroadcastReceiver {
    public static final String TAG = "BootCompleteReceiver";
    @Override
    public void onReceive(Context context, Intent intent) {
        if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
            // 应用启动逻辑，比如启动服务或者Activity
            Log.i(TAG, "i am starting");
            Intent appIntent = new Intent(context, MainActivity2.class);
            appIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(appIntent);
            Log.i(TAG, "i am ending");
        }
    }

}
